/*
 * @Descripttion: 
 * @version: 
 * @Author: by
 * @Date: 2021-06-04 09:45:24
 * @LastEditors: by
 * @LastEditTime: 2021-07-23 11:56:38
 */
const LocalStorage = {
    set (key, value, times) {
        let data = { value: value, expirse: new Date(times).getTime() }
        localStorage.setItem(key, JSON.stringify(data))
    },
    get (key) {
        let data = JSON.parse(localStorage.getItem(key));
        if (data !== null) {
            if (data.expirse != null && data.expirse < new Date().getTime()) {
                localStorage.removeItem(key)
            } else {
                return data.value
            }
        }
        return null
    }
}
export default LocalStorage